package sv.gob.mh.dgii.model;

// Generated Dec 12, 2007 3:08:52 PM by Hibernate Tools 3.2.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * TbActEco generated by hbm2java
 */
@Entity
@Table(name = "TB_ACT_ECO", schema = "CATALOGOS")
public class TbActEco implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String cactEco;
	private String cusuario;
	private String dactEco;
	private Date fhingreso;
	private Boolean bstatus;
	private Boolean bdesplegable;
	private Set<RcActEco> rcActEcos = new HashSet<RcActEco>(0);	

	public TbActEco() {
	}

	public TbActEco(String cactEco, String cusuario, String dactEco,
			Boolean bstatus, Boolean bdesplegable) {
		this.cactEco = cactEco;
		this.cusuario = cusuario;
		this.dactEco = dactEco;
		this.bstatus = bstatus;
		this.bdesplegable = bdesplegable;
	}

	public TbActEco(String cactEco, String cusuario, String dactEco,
			Date fhingreso, Boolean bstatus, Boolean bdesplegable,
			Set<RcActEco> rcActEcos) {
		this.cactEco = cactEco;
		this.cusuario = cusuario;
		this.dactEco = dactEco;
		this.fhingreso = fhingreso;
		this.bstatus = bstatus;
		this.bdesplegable = bdesplegable;
		this.rcActEcos = rcActEcos;		
	}

	@Id
	@Column(name = "C_ACT_ECO", unique = true, nullable = false, length = 6)
	public String getCactEco() {
		return this.cactEco;
	}

	public void setCactEco(String cactEco) {
		this.cactEco = cactEco;
	}

	@Column(name = "C_USUARIO", nullable = false, length = 30)
	public String getCusuario() {
		return this.cusuario;
	}

	public void setCusuario(String cusuario) {
		this.cusuario = cusuario;
	}

	@Column(name = "D_ACT_ECO", nullable = false, length = 160)
	public String getDactEco() {
		return this.dactEco;
	}

	public void setDactEco(String dactEco) {
		this.dactEco = dactEco;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "FH_INGRESO", length = 7)
	public Date getFhingreso() {
		return this.fhingreso;
	}

	public void setFhingreso(Date fhingreso) {
		this.fhingreso = fhingreso;
	}

	@Column(name = "B_STATUS", nullable = false, precision = 1, scale = 0)
	public Boolean getBstatus() {
		return this.bstatus;
	}

	public void setBstatus(Boolean bstatus) {
		this.bstatus = bstatus;
	}

	@Column(name = "B_DESPLEGABLE", nullable = false, precision = 1, scale = 0)
	public Boolean getBdesplegable() {
		return this.bdesplegable;
	}

	public void setBdesplegable(Boolean bdesplegable) {
		this.bdesplegable = bdesplegable;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbActEco")
	public Set<RcActEco> getRcActEcos() {
		return this.rcActEcos;
	}

	public void setRcActEcos(Set<RcActEco> rcActEcos) {
		this.rcActEcos = rcActEcos;
	}

        @Transient
        public String getDactEcoAbrev(){
            return dactEco.length()>70 ? this.dactEco.substring(0,70)+"...":this.dactEco;
        }

}
